package com.football.dao.Implement;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.football.dao.Interface.TeamDAO;
import com.football.model.League;
import com.football.model.Team;

@Repository
public class TeamDAOImpl extends AbstractDAOImpl implements TeamDAO {

	@Transactional
	public void addNewTeam(Team team) {
		getSession().save(team);
	}

	@Transactional
	public void addTeamWithLeague(Team team, League league) {
		team.getLeagues().add(league);
		getSession().persist(team);
		getSession().flush();
	}

}
